package com.example.musicdemo.util

import com.example.musicdemo.model.Music
import java.util.*

class PinyinComparator : Comparator<Music> {
    override fun compare(o1: Music?, o2: Music?): Int {
         if (o1?.sortLetters.equals("@")
            || o2?.sortLetters.equals("#")
        ) {
          return  -1
        } else if (o1?.sortLetters.equals("#")
            || o2?.sortLetters.equals("@")
        ) {
         return   1
        } else {
            if (o2?.sortLetters ==null) return 0
           return o1?.sortLetters?.compareTo(o2?.sortLetters!!) as Int
        }
    }

}